package com.jjyu.service;

import com.jjyu.entity.StoreReview;
import com.jjyu.dao.StoreReviewMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StoreReviewService {

    @Autowired
    private StoreReviewMapper storeReviewMapper;

    public void addReview(StoreReview storeReview) {
        storeReviewMapper.insert(storeReview);
    }

    public List<StoreReview> getReviewsByRestaurantId(Integer restaurantId) {
        return storeReviewMapper.findByRestaurantId(restaurantId);
    }

    public List<StoreReview> getReviewsByUserId(Integer userId) {
        return storeReviewMapper.findByUserId(userId);
    }
}
